#ifndef ORG_WXW0303_COMMON_PREPROCESS_H
#define ORG_WXW0303_COMMON_PREPROCESS_H


// 此时不对 x,y 执行宏展开,而且直接连接起来.
#define ___CONCAT_IMPL(x,y) x ## y
#define COMMON_CONCAT(x,y) ___CONCAT_IMPL(x,y)

#define ANONYMOUS_NAME(var) COMMON_CONCAT(var,__LINE__)

#define DENY_COPY(className) \
    className(const className&) = delete
#define DENY_MOVE_COPY(Class) \
    Class(Class &&) = delete
#define DENY_ASSIGN(Class) \
    Class& operator=(const Class &) = delete
#define DENY_MOVE_ASSIGN(Class)	\
    Class& operator=(Class &&) = delete
#define DENY_ALL_COPY_ALL_ASSIGN(Class)	\
    DENY_COPY(Class);	\
    DENY_MOVE_COPY(Class); \
    DENY_ASSIGN(Class); \
    DENY_MOVE_ASSIGN(Class)

// 获取数组 a 中元素的个数.
#define array_size(a) (sizeof(a) / sizeof(a[0]))

#if defined _WIN32 || defined __CYGWIN__
  #ifdef BUILDING_DLL
    #ifdef __GNUC__
      #define COMMON_DLL_PUBLIC __attribute__ ((dllexport))
    #else
      #define COMMON_DLL_PUBLIC __declspec(dllexport)
    #endif
  #else
    #ifdef __GNUC__
      #define COMMON_DLL_PUBLIC __attribute__ ((dllimport))
    #else
      #define COMMON_DLL_PUBLIC __declspec(dllimport)
    #endif
  #endif
  #define COMMON_DLL_LOCAL
#else
  #if __GNUC__ >= 4
    #define COMMON_DLL_PUBLIC __attribute__ ((visibility ("default")))
    #define COMMON_DLL_LOCAL  __attribute__ ((visibility ("hidden")))
  #else
    #define COMMON_DLL_PUBLIC
    #define COMMON_DLL_LOCAL
  #endif
#endif

#define COMMON_SYM_PUBLIC  COMMON_DLL_PUBLIC
#define COMMON_SYM_PRIVATE COMMON_DLL_LOCAL
#define _SYM_PUBLIC COMMON_SYM_PUBLIC
#define _SYM_PRIVATE COMMON_SYM_PRIVATE

#endif // ORG_WXW0303_COMMON_PREPROCESS_H
